<%--
  Created by IntelliJ IDEA.
  User: 杨娇
  Date: 2025/6/23
  Time: 10:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>绿能充 - 用户登录</title>
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        :root {
            --primary-color: #00a896;
            --secondary-color: #02c39a;
            --admin-color: #d64550;
            --tester-color: #f39c12;
            --user-color: #3498db;
            --dark-color: #05668d;
            --light-color: #f0f3bd;
            --text-dark: #333;
            --text-light: #f8f9fa;
            --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Noto Sans SC', sans-serif;
            color: var(--text-dark);
            background-color: #f9f9f9;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
        }

        .auth-page {
            width: 100%;
            max-width: 450px;
        }

        .auth-container {
            width: 100%;
            padding: 50px 40px;
            background-color: white;
            border-radius: 15px;
            box-shadow: var(--shadow);
            position: relative;
            overflow: hidden;
        }

        .auth-container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 5px;
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
        }

        .auth-logo {
            width: 70px;
            height: 70px;
            margin: 0 auto 20px;
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            color: white;
            font-size: 28px;
            box-shadow: 0 5px 15px rgba(0, 168, 150, 0.3);
        }

        .auth-header {
            text-align: center;
            margin-bottom: 40px;
        }

        .auth-header h2 {
            color: var(--dark-color);
            margin-bottom: 10px;
            font-size: 2rem;
        }

        .auth-header p {
            color: #777;
            font-size: 0.95rem;
        }

        .form-group {
            margin-bottom: 25px;
            position: relative;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #555;
            font-size: 0.95rem;
        }

        .form-group input {
            width: 100%;
            padding: 14px 15px 14px 45px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 15px;
            transition: var(--transition);
            background-color: #fafafa;
        }

        .form-group input:focus {
            border-color: var(--primary-color);
            outline: none;
            box-shadow: 0 0 0 3px rgba(0, 168, 150, 0.1);
            background-color: white;
        }

        .input-icon {
            position: absolute;
            left: 15px;
            top: 40px;
            color: #999;
            font-size: 18px;
        }

        .auth-btn {
            width: 100%;
            padding: 14px;
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: var(--transition);
            margin-top: 10px;
            box-shadow: 0 4px 15px rgba(0, 168, 150, 0.3);
        }

        .auth-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 168, 150, 0.4);
        }

        .switch-auth {
            text-align: center;
            margin-top: 25px;
            font-size: 0.95rem;
            color: #777;
        }

        .switch-auth a {
            color: var(--primary-color);
            text-decoration: none;
            font-weight: 500;
            margin-left: 5px;
            transition: var(--transition);
        }

        .switch-auth a:hover {
            color: var(--dark-color);
            text-decoration: underline;
        }

        .social-auth {
            margin-top: 30px;
            text-align: center;
        }

        .social-auth p {
            color: #999;
            font-size: 14px;
            margin-bottom: 15px;
            position: relative;
        }

        .social-auth p::before,
        .social-auth p::after {
            content: '';
            position: absolute;
            top: 50%;
            width: 30%;
            height: 1px;
            background-color: #eee;
        }

        .social-auth p::before {
            left: 0;
        }

        .social-auth p::after {
            right: 0;
        }

        .social-icons {
            display: flex;
            justify-content: center;
            gap: 15px;
        }

        .social-icon {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 18px;
            cursor: pointer;
            transition: var(--transition);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

        .social-icon:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
        }

        .icon-google {
            background-color: #db4437;
        }

        .icon-wechat {
            background-color: #07C160;
        }

        .icon-alipay {
            background-color: #00A0E9;
        }

        /* 角色选择样式 */
        .role-selection {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-bottom: 25px;
        }

        .role-option {
            flex: 1;
            text-align: center;
            padding: 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: var(--transition);
            border: 2px solid #eee;
            background-color: #f9f9f9;
        }

        .role-option:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow);
        }

        .role-option.selected {
            border-color: var(--primary-color);
            background-color: rgba(0, 168, 150, 0.05);
        }

        .role-option.admin {
            border-color: var(--admin-color);
        }

        .role-option.tester {
            border-color: var(--tester-color);
        }

        .role-option.user {
            border-color: var(--user-color);
        }

        .role-option.selected.admin {
            background-color: rgba(214, 69, 80, 0.05);
        }

        .role-option.selected.tester {
            background-color: rgba(243, 156, 18, 0.05);
        }

        .role-option.selected.user {
            background-color: rgba(52, 152, 219, 0.05);
        }

        .role-icon {
            font-size: 24px;
            margin-bottom: 8px;
        }

        .admin .role-icon {
            color: var(--admin-color);
        }

        .tester .role-icon {
            color: var(--tester-color);
        }

        .user .role-icon {
            color: var(--user-color);
        }

        .role-name {
            font-weight: 500;
            font-size: 14px;
        }

        /* 响应式设计 */
        @media (max-width: 576px) {
            .auth-container {
                padding: 40px 25px;
            }

            .role-selection {
                flex-direction: column;
                gap: 10px;
            }
        }
    </style>
</head>
<body>
<div class="auth-page" id="loginPage">
    <div class="auth-container">
        <div class="auth-logo">
            <i class="fas fa-charging-station"></i>
        </div>
        <div class="auth-header">
            <h2>绿能充登录</h2>
            <p>请选择您的角色并登录系统</p>
        </div>

        <!-- 角色选择 -->
        <div class="role-selection">
            <div class="role-option user selected" data-role="USER">
                <div class="role-icon">
                    <i class="fas fa-user"></i>
                </div>
                <div class="role-name">普通用户</div>
            </div>
            <div class="role-option admin" data-role="ADMIN">
                <div class="role-icon">
                    <i class="fas fa-user-cog"></i>
                </div>
                <div class="role-name">管理员</div>
            </div>
            <div class="role-option tester" data-role="TESTER">
                <div class="role-icon">
                    <i class="fas fa-user-edit"></i>
                </div>
                <div class="role-name">测试员</div>
            </div>
        </div>

        <form id="loginForm" action="/user/login" method="post">
            <input type="hidden" name="role" value="USER">
            <div class="form-group">
                <label for="username">用户名</label>
                <i class="fas fa-user input-icon"></i>
                <input type="text" id="username" name="username" placeholder="请输入用户名" required>
            </div>
            <div class="form-group">
                <label for="password">密码</label>
                <i class="fas fa-lock input-icon"></i>
                <input type="text" id="password" name="password" placeholder="请输入密码" required>
            </div>
            <button type="submit" class="auth-btn">登录</button>
        </form>

        <div class="switch-auth">
            <span>还没有账号?</span>
            <a href="/user/register">立即注册</a>
        </div>

        <div class="social-auth">
            <p>其他登录方式</p>
            <div class="social-icons">
                <div class="social-icon icon-wechat">
                    <i class="fab fa-weixin"></i>
                </div>
                <div class="social-icon icon-alipay">
                    <i class="fab fa-alipay"></i>
                </div>
                <div class="social-icon icon-google">
                    <i class="fab fa-google"></i>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    // 角色选择功能保持不变
    document.querySelectorAll('.role-option').forEach(option => {
        option.addEventListener('click', function() {
            const parent = this.parentElement;
            parent.querySelectorAll('.role-option').forEach(el => {
                el.classList.remove('selected');
            });
            this.classList.add('selected');
            document.querySelector('input[name="role"]').value = this.getAttribute('data-role');
        });
    });

    // 简化后的表单提交验证（仅检查非空）
    document.getElementById('loginForm').addEventListener('submit', function(e) {
        const username = document.getElementById('username').value.trim();
        const password = document.getElementById('password').value.trim();

        if (!username || !password) {
            e.preventDefault();
            alert('用户名和密码不能为空');
        }
    });
</script>
</body>
</html>